@extends('Admin.layout')
@section('content')

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
               分类管理
                <small>分类编辑</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="#">分类管理</a></li>
                <li class="active">分类编辑</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速编辑分类</h3>
                        </div><!-- /.box-header -->


                        <!-- form start -->
                        <form role="form" method="post" action="{{ url('/admin/cate/') }}/{{ $data->id }}"  >
                         {{ csrf_field() }}
                         {{ method_field('put') }}
                            <div class="box-body">

                                @if (session('info'))
                                <div class="alert alert-danger alert-dismissable">
                                <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                                <h4><i class="icon fa fa-ban"></i> 提示!</h4> 
                                    <h4> {{ session('info') }}  </h4>
                                </div>
                                @endif



                                @if (count($errors) > 0)
                                <div class="alert alert-danger alert-dismissable">
                                <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                                <h4><i class="icon fa fa-ban"></i> 警告!</h4> 
                                    <ol>
                                    @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                    @endforeach
                                    </ol>
                                </div>
                                @endif
                                

                                <div class="form-group">
                                    <label for="name">分类名</label>
                                    <input type="text" class="form-control" id="name" value="{{ $data->name }}" name="name"  placeholder="请输入分类名">
                                </div>
                                
                                 <div class="form-group">
                                <label for="pid">父级类</label>
                                <select class="form-control select2" name="pid" style="width: 100%;">
                                    @foreach($alldata as $cate)
                                    <option value="{{ $cate->id}}"
                                    @if( $cate->id==$data->pid )
                                    selected='true';
                                    @endif
                                    @if( $cate->id==$data->id )
                                    disabled='true';
                                    @endif
                                    >{{ $cate->name }}</option>
                                    @endforeach
                                </select>
                                </div><!-- /.form-group -->

                                
                                
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">编辑</button>
                                <button type="reset" class="btn btn-default">重置</button>
                            </div>

                        </form>
                    </div><!-- /.box -->


                    <!-- Input addon -->
                

                </div><!--/.col (left) -->
                <!-- right column -->
             
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->





@endsection